package com.xnx3.banmahuishou.userApplet.vo;

import java.util.ArrayList;
import java.util.List;
import com.xnx3.j2ee.system.responseBody.ResponseBodyManage;
import com.xnx3.j2ee.vo.BaseVO;
import com.xnx3.wangmarket.shop.core.entity.Address;
import com.xnx3.wangmarket.shop.core.entity.OrderGoods;

/**
 * 购物车
 * @author 管雷鸣
 */
@ResponseBodyManage(nullSetDefaultValue = true)
public class CartVO extends BaseVO{
	private Address address;		//上门取货的地址信息
	private List<OrderGoods> orderGoodsList;	//上门取货的商品列表，也就是类似于购物车的商品列表
	private int allMoney;	//当前计算好的购物车中的商品的总预估价格。单位是分。会在 getAllMoney() 时自动计算总金额
	
	public CartVO() {
//		this.address = new Address();	这个要获取用户当前设置的默认地址
		this.orderGoodsList = new ArrayList<OrderGoods>();
		this.allMoney = 0;
	}
	
	public Address getAddress() {
		return address;
	}
	public void setAddress(Address address) {
		this.address = address;
	}
	public List<OrderGoods> getOrderGoodsList() {
		return orderGoodsList;
	}
	public void setOrderGoodsList(List<OrderGoods> orderGoodsList) {
		this.orderGoodsList = orderGoodsList;
	}

	public int getAllMoney() {
		int all = 0;
		for (int i = 0; i < orderGoodsList.size(); i++) {
			OrderGoods og = orderGoodsList.get(i);
			all = all + og.getMoney();
		}
		return all;
	}

	public void setAllMoney(int allMoney) {
		this.allMoney = allMoney;
	}
	
}